<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>document</title>
    <style>
        .navs{
            width: 480px;
            display: flex;
            justify-content: space-between;
        }
        .nav{
            width: 110px;
            height: 50px;
            text-align: center;
            line-height: 50px;
            background: pink;
            color: #fff;
            border-radius: 50px;
            cursor: pointer;
        }
        .nav.active{
            background-color: deeppink;
            color: aquamarine;
        }

        .cit{
            width: 500px;
            height: 500px;
            text-align: center;
            color:crimson;
            background: darkorchid;
            font-size: 60px;
            line-height: 500px;
            margin-top: 30px;
            border-radius: 50px;
        }
        .cit.act{
            color: #fff;
            background-color:cornflowerblue;
        }
    </style>
</head>
<body>
    <div id="app">
        <h2>{{title}}</h2>

        <div class="main">
            <div class="navs">
            <div class="nav" @click="change(0)" :class="current==0?'active':''">情感小说</div>
            <div class="nav" @click="change(1)" :class="current==1?'active':''">悬疑小说</div>
            <div class="nav" @click="change(2)" :class="current==2?'active':''">玄幻小说</div>
            <div class="nav" @click="change(3)" :class="current==3?'active':''">修仙小说</div>
            </div>
        </div>

        <div class="content">
            <div class="cit" :style="{display:current==0?'block':'none'}" :class="current==0?'act':''">情感小说-100</div>
            <div class="cit" :style="{display:current==1?'block':'none'}">悬疑小说-50</div>
            <div class="cit" :style="{display:current==2?'block':'none'}" :class="current==2?'act':''">玄仙小说-30</div>
            <div class="cit" :style="{display:current==3?'block':'none'}">修仙小说-10</div>
        </div>
    </div>

    <script>
        const vm = new Vue({
            data:{
                title:"class & style 绑定",
                current:0,
            },
            mounted(){
                document.getElementsByTagName("title")[0].innerHTML = this.title
                
            },
            methods:{
                change(index){
                    this.current = index;
                }
            }
        }).$mount("#app")
      
    </script>
</body>
</html>